package cn.gok.plusdemo.dao;

import cn.gok.plusdemo.entity.Clazz;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 林
 * @since 2022-07-22
 */
@Mapper
public interface ClazzDao extends BaseMapper<Clazz> {
    @Select("select * from clazz where cid=#{cid}")
    @Results(id = "clazzMapper",value = {
            @Result(property = "cid",column = "cid"),
            @Result(property = "cname",column = "cname"),
            @Result(property = "version",column = "version"),
            @Result(property = "delted",column = "delted"),
            @Result(property = "createTime",column = "create_time"),
            @Result(property = "updateTime",column = "update_time"),
            @Result(property = "studentList",column = "cid"
                    ,many = @Many(select = "cn.gok.plusdemo.dao.StudentDao.findStudentByCid")
            )
    })
    Clazz findClazzAndStudent(long id);
}
